package com.qianbao.dao.coinrecord;


import com.qianbao.domain.coinrecord.CoinRecordEntity;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface CoinRecordDao {


    /**
     * 分页查询用户的金币记录
     * @param customId
     * @param pageNo
     * @param pageSize
     * @return
     */
    @Select("SELECT * FROM sys_user_coin_record WHERE custom_id = #{customId} " +
            "ORDER BY record_create_time DESC LIMIT #{pageNo},#{pageSize}")
    public List<CoinRecordEntity> findAllRecordList(
            @Param("customId")String customId, @Param("pageNo")int pageNo, @Param("pageSize")int pageSize);


    /**
     * 插入一条记录
     * @param entity
     * @return
     */
    @Insert("insert into sys_user_coin_record (coin_record_id,custom_id,coin_record_tip,coin_number,record_create_time) " +
            "values (#{coin_record_id},#{custom_id},#{coin_record_tip},#{coin_number},#{record_create_time})")
    public int insertRecord(CoinRecordEntity entity);




}



































